package com.ft.admix.ad;

import com.ft.admix.base.IAdProvider;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class AdProviderRegistry {
    private static final Map<String, IAdProvider> providers = new ConcurrentHashMap<>();
    
    public static void registerProvider(IAdProvider provider) {
        if (provider != null) {
            providers.put(provider.getPlatformName().toUpperCase(), provider);
        }
    }
    
    public static void unregisterProvider(String platformName) {
        if (platformName != null) {
            providers.remove(platformName.toUpperCase());
        }
    }
    
    public static IAdProvider getProvider(String platformName) {
        return providers.get(platformName.toUpperCase());
    }
    
    public static Set<String> getRegisteredPlatforms() {
        return new HashSet<>(providers.keySet());
    }
}